import {
    request
} from "../utils/request.js";
export default {
    // 根据传入的当前页和获取影院信息
    get: async ({
        curPage,
        eachPage
    }) => {
        return await request({
            type: "GET",
            data: {
                curPage,
                eachPage
            },
            url: "/api/theaters",
        })
    },
    // 获取全部影院信息
    getAllCinemas: async () => {
        return await request({
            type: "GET",
            url: "/api/theaters/cinemas",
        })
    },
    // 新增影厅
    addTheaters: async ({
        cinemasId,
        theatersName,
        theatersStatus
    }) => {
        return await request({
            type: "post",
            url: "/api/theaters",
            data: {
                cinemasId,
                theatersName,
                theatersStatus
            }
        })
    },
    // 删除影院信息 传入参数是 _id
    del: async ({
        _id
    }) => {
        return await request({
            type: "DELETE",
            url: `/api/theaters/${_id}`,
        })
    },
    // 获取一条影院的数据 传入参数是一个影厅的id
    getOnetheaters: async ({
        _id
    }) => {
        return await request({
            type: "GET",
            url: `/api/theaters/theaters/${_id}`,
        })
    },
    // 修改影厅的数据，传入参数是要修改影院的id，和其他的所有信息
    changeTheaters: async ({
        _id,
        cinemasId,
        theatersName,
        theatersStatus
    }) => {
        return await request({
            type: "PUT",
            url: `/api/theaters/${_id}`,
            data: {
                cinemasId,
                theatersName,
                theatersStatus
            }
        })
    },

    // 查询影厅的数据传入参数是 查询类型和对应的值
    select: async (data) => {
        return await request({
            type: "get",
            url: `/api/theaters/select`,
            data: data
        })
    },
    // 查询用户选择要查询的选项 的数据传入参数是 查询类型
    allCinemas: async () => {
        return await request({
            type: "get",
            url: `/api/theaters/allCinemas`,
        })
    },


};